<?php
class SessionUtil
{
public static function setVar($name,$value)
{
	if(!isset($_SESSION)){
		session_start();
	}
	$_SESSION[$name] = $value;
}
public static function getVar($name)
{
	if(!isset($_SESSION)){
		session_start();
	}
	return SessionUtil::isExistVar($name)?$_SESSION[$name]:null;
}
public static function removeVar($name)
{
	if(!isset($_SESSION)){
		session_start();
	}
	unset($_SESSION[$name]); 
	
}
public static function isExistVar($name)
{
	if(!isset($_SESSION)){
		session_start();
	}
	return isset($_SESSION[$name]);
}
public static function getId()
{
	if(!isset($_SESSION)){
		session_start();
	}
	return session_id();
}
public static function destory()
{
	if(!isset($_SESSION)){
		session_start();
	}
	// Unset all of the session variables.
	$_SESSION = array();
	
	// If it's desired to kill the session, also delete the session cookie.
	// Note: This will destroy the session, and not just the session data!
	if (isset($_COOKIE[session_name()])) {
		setcookie(session_name(), '', time()-42000, '/');
	}

	session_destroy();
}
}
?>